package com.zhou.simulation.utils;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 * @ProjectName: simulation
 * @Package: com.zhou.simulation.utils
 * @ClassName: ApplicationContextUntil
 * @Author: zhoujingbo
 * @Description: <p>
 * @Date: 2020/10/9 16:34
 * @Version: 1.0
 */
public class ApplicationContextUntil implements ApplicationContextAware {
    private static ApplicationContext applicationContext;
    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        ApplicationContextUntil.applicationContext = applicationContext;
    }
    public static Object getBean(String beanId) {
        return applicationContext.getBean(beanId);
    }
}
